package com.it.park.rms.service;

import java.util.Arrays;

public class MyArrayList {
	private int size = 0;
	private Object[] objects = null;
	
	public MyArrayList(int size){
		objects = new Object[size];
	}
	
	public MyArrayList(){
		this(10);
	}
	
	public int size(){
		System.out.println(Arrays.asList(objects));
		return size;
	}
	
	public void add(String str){
		System.out.println(size);
		objects[size]=str;
		size ++;
		if(size >= objects.length){
			Object[] newObj = new Object[2*objects.length];
			System.arraycopy(objects, 0, newObj, 0, objects.length);
			objects = newObj;
		}
	}
	
	public Object get(int index){
		return objects[index];
	}
}
